call

inline suspend fun <T> Functions.call(name: String, vararg args: Any?): T

Invokes an Atlas function.

Since the serialization engine does not support third-party libraries yet, there are some limitations in what types can be used as arguments and return types:

  • Primitives, Bson, MutableRealmInt, RealmUUID, ObjectId, RealmInstant, RealmAny, Array, Collection, and Map are valid argument types.

  • Results can only be deserialized to Bson, MutableRealmInt, RealmUUID, ObjectId, RealmInstant, RealmAny and primitive types

The Bson implementations for arrays or maps are BsonArray and BsonDocument, and they can be used as valid return types.

Return

result of the function call.

Parameters

name

name of the function to call.

args

arguments to the function.

T

the function return value type.

Throws

for other failures that can happen when communicating with App Services. See AppException for details.